package games.guiso 
{
	import org.flixel.FlxGroup;
	import org.flixel.FlxObject;
	import org.flixel.FlxRect;
	import org.flixel.FlxSprite;
	import org.flixel.FlxState;
	import org.flixel.FlxG;
	
	/**
	 * ...
	 * @author Jacowaco
	 */
	public class GuisoGame extends FlxState 
	{
		private var mati:GuisoChar;
		protected var coins:FlxGroup;
		private var gameWidth:int;
		
		override public function create():void 
		{
			FlxG.mouse.hide();	
			FlxG.bgColor = 0xff000000;
			
			gameWidth = 10000;
			
			coins = new FlxGroup();
			
			add(coins);
			
			mati = new GuisoChar(60, FlxG.height / 2);
			add(mati);
			
			FlxG.worldBounds = new FlxRect(0, 0, gameWidth, FlxG.height);
			
			FlxG.camera.follow(mati);
			FlxG.camera.deadzone = new FlxRect(0, 0, 150, FlxG.height);
			FlxG.camera.bounds = new FlxRect(0, 0, gameWidth, FlxG.height);
		}
		
		override public function update():void 
		{
			super.update();
			
			FlxG.overlap(mati, coins, collectCoin);
		}
		
		public function collectCoin(obj1:FlxObject,obj2:FlxObject):void
		{
			obj2.kill();
		}
	}
}